﻿
Imports std

Public Class slice3
    Inherits slice2

    Public Shadows Const _version As String = "2"
    Public Shadows Const _maxSupportVersion As String = "2"
    Public Shadows Const _minSupportVersion As String = "2"
    Private Shared _datapathdepth As Int32

    Protected Overrides Function version() As String
        Return _version
    End Function

    Protected Overrides Function minSupportVersion() As String
        Return _minSupportVersion
    End Function

    Protected Overrides Function maxSupportVersion() As String
        Return _maxSupportVersion
    End Function

    Protected Overrides Function filter_slicetype_value() As String
        Return configNaming.filter.value.slicetype.slice3
    End Function

    Protected NotOverridable Overrides Function datapathdepth() As Int32
        Return _datapathdepth
    End Function

    Private Overloads Function datafile(ByVal atom As atom) As String
        Dim bts As bytes = Nothing
        bts = convertor.tobytes(convertor.toint32(signing(atom.guid)))
        Dim path As String = Nothing
        Dim i As Int64
        path = Convert.ToString(bts(0))
        For i = 1 To bts.size() - 2
            path = combinepath(path, Convert.ToString(bts(i)))
        Next
        Dim file As String = Nothing
        file = Convert.ToString(bts(bts.size() - 1))
        Dim fullpath As String = Nothing
        fullpath = combinepath(datarootpath(), path)
        createDirectory(fullpath)

        Return combinepath(fullpath, file)
    End Function

    Protected Overrides Function datafile(ByVal atom As _atom_base) As String
        Return datafile(c(atom))
    End Function

    Shared Sub New()
        _datapathdepth = convertor.tobytes(convertor.toint32(0)).size() - 1
    End Sub
End Class
